package com.ybkj.daijia.server.zhuanxian;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;

public class Order extends com.ybkj.daijia.server.abstractModels.Order implements Serializable {

    /**
     * 新单
     */
    public static final Integer ORDER_STATUS_NEW = 0;
    /**
     * 已派单
     */
    public static final Integer ORDER_STATUS_PAIDAN = 1;
    /**
     * 已接单
     */
    public static final Integer ORDER_STATUS_JIEDAN = 2;
    /**
     * 到达预约地
     */
    public static final Integer ORDER_STATUS_ARRIVE = 3;
    /**
     * 执行中
     */
    public static final Integer ORDER_STATUS_ZHIXING = 4;
    /**
     * 已完成
     */
    public static final Integer ORDER_STATUS_OK = 5;
    /**
     * 已销单
     */
    public static final Integer ORDER_STATUS_XIAODAN = 6;

    public static final String ORDER_TYPE_PHONE = "电话预约";
    public static final String ORDER_TYPE_APP = "APP预约";
    public static final String ORDER_TYPE_WEIXIN = "微信预约";
    public static final String ORDER_TYPE_WEB = "网站预约";
    public static final String ORDER_TYPE_BUDAN = "司机补单";

    /**
     * 城际拼车
     */
    public static final Integer TYPE_PINCHE = 0;
    /**
     * 城际包车
     */
    public static final Integer TYPE_BAOCHE = 1;
    /**
     * 城际寄货
     */
    public static final Integer TYPE_JIHUO = 2;
    private static final long serialVersionUID = 1L;
    private Date created;
    private Date updated;
    private Integer orderType;                     // 订单类型
    private Long passengerId;                   // 客户id
    private String passengerName;                 // 客户名称
    private String passengerPhone;                // 客户电话
    private Long carId;                         // 车辆id
    private String carName;                       // 车辆名称
    private String carNumber;                     // 车辆编号
    private Long lineId;                        // 路线id
    private String lineName;                      // 路线name
    private Long channelId;                     // 渠道id
    private Integer status;                        // 状态
    private String employName;                    // 服务人员name
    private String employPhone;                   // 服务人员电话
    private String companyName;                   // 公司name
    private String appkey;
    private Boolean isClosed;                      // 是否关闭催单提示框
    private Boolean review;                        // 是否已评价
    private Long version;                       // 数据库操作版本
    private String cancelCause;                   // 取消原因
    private String payType;                       // 支付类型
    private Date lasturge;                      // 最后一次催单时间
    private Integer startWait;                     // 开始等待分钟数
    private String startAddress;                  // 开始地址
    private Double startLat;                      // 开始经度
    private Double startLng;                      // 开始纬度
    private String endAddress;                    // 结束地址
    private Double endLat;                        // 结束经度
    private Double endLng;                        // 结束纬度
    private Long employCompanyId;               // 服务人员公司id
    private Double employProfit;                  // 司机收入
    private Double companyProfit;                 // 公司收入
    private Double startPrice;                    // 起步费
    private Double mileage;                       // 实际行使公里
    private Integer runTime;                       // 实际执行分钟数
    private Double mileagePrice;                  // 实际的行驶里程费用
    private Double runTimePrice;                  // 实际的服务时间费用
    private Long couponId;                      // 优惠券id
    private Double couponMoney;                   // 优惠券抵消金额
    private Double budgetPay;                     // 预计费用
    private Double realPay;                       // 实际费用
    private Double cashMoney;                     // 现金
    private Double signMoney;                     // 签单金额
    private Double balanceMoney;                  // 余额金额
    private Date serverTime;                    // 服务时间
    private Date serverDeadTime;                // 预约截止时间
    private String employNo;                      // 服务人员工号
    private String employPhoto;                   // 服务人员头像
    private Double employScore;                   // employScore
    private String startAddressDetail;             // 预约地详细地址
    private String endAddressDetail;               // 目的地详细地址
    private Double preStartPrice;                 // 预估开始时间
    private Double premileagePrice;               // 预估里程金额
    private Double prerunTimePrice;               // 预估时间金额
    private Integer pretravelTime;                 // 预估行驶金额
    private Double premileage;
    private Double alipayMoney;                   // 支付宝支付金额
    private Double weixinMoney;                   // 微信支付金额
    private Double unionpayMoney;                   // 银联支付金额
    private Double guoluMoney;                    // 过路费
    private Double yuanchengMoney;                // 远程费
    private Boolean treatment;                     // 是否处理过
    private PayTypeDetails prePayTypeDetail;               // 前一步支付详情
    private PayTypeDetails afterPayTypeDetail;             // 后一步支付详情
    private Double otherMoney;                    // 其他费用
    private String showPhone;
    private Double waitPrice;
    private Boolean firstOrderFree;
    private Date finishTime;
    private boolean baoxiao;
    private Double baoxiaoMoney;
    private String employMemo;
    private Date treatmentDate;
    private Long areaId;
    private List<OrderMemo> orderMemos;                     // 订单备注
    private OrderReview orderReview;                    // 评价备注
    private List<OrderStatus> statusList;                     // 订单的所有状态记录
    private Long peopleNumber;                  // 乘坐人数
    private String memo;
    private String takeDeliveryName;               // 寄货人名字
    private String takeDeliveryPhone;              // 寄货人电话
    private Double discount;                       // 折扣
    private String showName;
    private Double justKilometres;                 //司机调价（公里数）
    private BigDecimal justMoney;                      //司机调价（金额）
    /**
     * 随机红包
     */
    private Double randomRedPacket;

    public Double getRandomRedPacket() {
        return randomRedPacket;
    }

    public void setRandomRedPacket(Double randomRedPacket) {
        this.randomRedPacket = randomRedPacket;
    }

    public Double getJustKilometres() {
        return justKilometres;
    }

    public void setJustKilometres(Double justKilometres) {
        this.justKilometres = justKilometres;
    }

    public BigDecimal getJustMoney() {
        return justMoney;
    }

    public void setJustMoney(BigDecimal justMoney) {
        this.justMoney = justMoney;
    }

    public String getShowName() {
        return showName;
    }

    public void setShowName(String showName) {
        this.showName = showName;
    }

    public Double getDiscount() {
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    public String getTakeDeliveryName() {
        return takeDeliveryName;
    }

    public void setTakeDeliveryName(String takeDeliveryName) {
        this.takeDeliveryName = takeDeliveryName;
    }

    public String getTakeDeliveryPhone() {
        return takeDeliveryPhone;
    }

    public void setTakeDeliveryPhone(String takeDeliveryPhone) {
        this.takeDeliveryPhone = takeDeliveryPhone;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public Long getPeopleNumber() {
        if (null == peopleNumber) {
            return 0L;
        }
        return peopleNumber;
    }

    public void setPeopleNumber(Long peopleNumber) {
        this.peopleNumber = peopleNumber;
    }

    public List<OrderMemo> getOrderMemos() {
        return orderMemos;
    }

    public void setOrderMemos(List<OrderMemo> orderMemos) {
        this.orderMemos = orderMemos;
    }

    public OrderReview getOrderReview() {
        return orderReview;
    }

    public void setOrderReview(OrderReview orderReview) {
        this.orderReview = orderReview;
    }


    public List<OrderStatus> getStatusList() {
        return statusList;
    }

    public void setStatusList(List<OrderStatus> statusList) {
        this.statusList = statusList;
    }

    public Long getAreaId() {
        return areaId;
    }

    public void setAreaId(Long areaId) {
        this.areaId = areaId;
    }

    public Long getPassengerId() {
        return passengerId;
    }

    public void setPassengerId(Long passengerId) {
        this.passengerId = passengerId;
    }

    public String getPassengerName() {
        return passengerName;
    }

    public void setPassengerName(String passengerName) {
        this.passengerName = passengerName == null ? null : passengerName.trim();
    }

    public String getPassengerPhone() {
        return passengerPhone;
    }

    public void setPassengerPhone(String passengerPhone) {
        this.passengerPhone = passengerPhone == null ? null : passengerPhone.trim();
    }

    public Long getCarId() {
        return carId;
    }

    public void setCarId(Long carId) {
        this.carId = carId;
    }

    public String getCarName() {
        return carName;
    }

    public void setCarName(String carName) {
        this.carName = carName == null ? null : carName.trim();
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber == null ? null : carNumber.trim();
    }

    public Long getLineId() {
        return lineId;
    }

    public void setLineId(Long lineId) {
        this.lineId = lineId;
    }

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName == null ? null : lineName.trim();
    }

    public Long getChannelId() {
        return channelId;
    }

    public void setChannelId(Long channelId) {
        this.channelId = channelId;
    }


    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getEmployName() {
        return employName;
    }

    public void setEmployName(String employName) {
        this.employName = employName == null ? null : employName.trim();
    }

    public String getEmployPhone() {
        return employPhone;
    }

    public void setEmployPhone(String employPhone) {
        this.employPhone = employPhone == null ? null : employPhone.trim();
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName == null ? null : companyName.trim();
    }

    public String getAppkey() {
        return appkey;
    }

    public void setAppkey(String appkey) {
        this.appkey = appkey == null ? null : appkey.trim();
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public Boolean getIsClosed() {
        return isClosed;
    }

    public void setIsClosed(Boolean isClosed) {
        this.isClosed = isClosed;
    }

    public Boolean getReview() {
        return review;
    }

    public void setReview(Boolean review) {
        this.review = review;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

    public String getCancelCause() {
        return cancelCause;
    }

    public void setCancelCause(String cancelCause) {
        this.cancelCause = cancelCause == null ? null : cancelCause.trim();
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType == null ? null : payType.trim();
    }

    public Date getLasturge() {
        return lasturge;
    }

    public void setLasturge(Date lasturge) {
        this.lasturge = lasturge;
    }

    public Integer getStartWait() {
        return (null == startWait ? 0 : startWait);
    }

    public void setStartWait(Integer startWait) {
        this.startWait = startWait;
    }

    public String getStartAddress() {
        return startAddress;
    }

    public void setStartAddress(String startAddress) {
        this.startAddress = startAddress == null ? null : startAddress.trim();
    }

    public Double getStartLat() {
        return startLat;
    }

    public void setStartLat(Double startLat) {
        this.startLat = startLat;
    }

    public Double getStartLng() {
        return startLng;
    }

    public void setStartLng(Double startLng) {
        this.startLng = startLng;
    }

    public String getEndAddress() {
        return endAddress;
    }

    public void setEndAddress(String endAddress) {
        this.endAddress = endAddress == null ? null : endAddress.trim();
    }

    public Double getEndLat() {
        return endLat;
    }

    public void setEndLat(Double endLat) {
        this.endLat = endLat;
    }

    public Double getEndLng() {
        return endLng;
    }

    public void setEndLng(Double endLng) {
        this.endLng = endLng;
    }

    public Long getEmployCompanyId() {
        return employCompanyId;
    }

    public void setEmployCompanyId(Long employCompanyId) {
        this.employCompanyId = employCompanyId;
    }

    public Double getEmployProfit() {
        return employProfit;
    }

    public void setEmployProfit(Double employProfit) {
        this.employProfit = employProfit;
    }

    public Double getCompanyProfit() {
        return companyProfit;
    }

    public void setCompanyProfit(Double companyProfit) {
        this.companyProfit = companyProfit;
    }

    public Double getStartPrice() {
        return startPrice;
    }

    public void setStartPrice(Double startPrice) {
        this.startPrice = startPrice;
    }

    public Double getMileage() {
        if (null == mileage) {
            return 0D;
        }
        return mileage;
    }

    public void setMileage(Double mileage) {
        this.mileage = mileage;
    }

    public Integer getRunTime() {
        return runTime;
    }

    public void setRunTime(Integer runTime) {
        this.runTime = runTime;
    }

    public Double getMileagePrice() {
        return mileagePrice;
    }

    public void setMileagePrice(Double mileagePrice) {
        this.mileagePrice = mileagePrice;
    }

    public Double getRunTimePrice() {
        return runTimePrice;
    }

    public void setRunTimePrice(Double runTimePrice) {
        this.runTimePrice = runTimePrice;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public Double getCouponMoney() {
        if (null == couponMoney) {
            return 0D;
        }
        return couponMoney;
    }

    public void setCouponMoney(Double couponMoney) {
        this.couponMoney = couponMoney;
    }

    public Double getBudgetPay() {
        if (null == budgetPay) {
            return 0D;
        }
        return budgetPay;
    }

    public void setBudgetPay(Double budgetPay) {
        this.budgetPay = budgetPay;
    }

    public Double getRealPay() {
        if (null == realPay) {
            return 0D;
        }
        return realPay;
    }

    public void setRealPay(Double realPay) {
        this.realPay = realPay;
    }

    public Double getCashMoney() {
        if (null == cashMoney) {
            return 0D;
        }
        return cashMoney;

    }

    public void setCashMoney(Double cashMoney) {
        this.cashMoney = cashMoney;
    }

    public Double getSignMoney() {
        if (null == signMoney) {
            return 0D;
        }
        return signMoney;
    }

    public void setSignMoney(Double signMoney) {
        this.signMoney = signMoney;
    }

    public Double getBalanceMoney() {
        if (null == balanceMoney) {
            return 0D;
        }
        return balanceMoney;
    }

    public void setBalanceMoney(Double balanceMoney) {
        this.balanceMoney = balanceMoney;
    }

    public Date getServerTime() {
        return serverTime;
    }

    public void setServerTime(Date serverTime) {
        this.serverTime = serverTime;
    }

    public Date getServerDeadTime() {
        return serverDeadTime;
    }

    public void setServerDeadTime(Date serverDeadTime) {
        this.serverDeadTime = serverDeadTime;
    }

    public String getEmployNo() {
        return employNo;
    }

    public void setEmployNo(String employNo) {
        this.employNo = employNo == null ? null : employNo.trim();
    }

    public String getEmployPhoto() {
        return employPhoto;
    }

    public void setEmployPhoto(String employPhoto) {
        this.employPhoto = employPhoto == null ? null : employPhoto.trim();
    }

    public Double getEmployScore() {
        return employScore;
    }

    public void setEmployScore(Double employScore) {
        this.employScore = employScore;
    }

    public String getStartAddressDetail() {
        return startAddressDetail;
    }

    public void setStartAddressDetail(String startAddressDetail) {
        this.startAddressDetail = startAddressDetail == null ? null : startAddressDetail.trim();
    }

    public String getEndAddressDetail() {
        return endAddressDetail;
    }

    public void setEndAddressDetail(String endAddressDetail) {
        this.endAddressDetail = endAddressDetail == null ? null : endAddressDetail.trim();
    }

    public Double getPreStartPrice() {
        return preStartPrice;
    }

    public void setPreStartPrice(Double preStartPrice) {
        this.preStartPrice = preStartPrice;
    }

    public Double getPremileagePrice() {
        return premileagePrice;
    }

    public void setPremileagePrice(Double premileagePrice) {
        this.premileagePrice = premileagePrice;
    }

    public Double getPrerunTimePrice() {
        return prerunTimePrice;
    }

    public void setPrerunTimePrice(Double prerunTimePrice) {
        this.prerunTimePrice = prerunTimePrice;
    }

    public Integer getPretravelTime() {
        return pretravelTime;
    }

    public void setPretravelTime(Integer pretravelTime) {
        this.pretravelTime = pretravelTime;
    }

    public Double getPremileage() {
        return premileage;
    }

    public void setPremileage(Double premileage) {
        this.premileage = premileage;
    }

    public Double getAlipayMoney() {
        if (null == alipayMoney) {
            return 0D;
        }
        return alipayMoney;
    }

    public void setAlipayMoney(Double alipayMoney) {
        this.alipayMoney = alipayMoney;
    }

    public Double getWeixinMoney() {
        if (null == weixinMoney) {
            return 0D;
        }
        return weixinMoney;
    }

    public void setWeixinMoney(Double weixinMoney) {
        this.weixinMoney = weixinMoney;
    }

    public Double getUnionpayMoney() {
        if (null == unionpayMoney) {
            return 0D;
        }
        return unionpayMoney;
    }

    public void setUnionpayMoney(Double unionpayMoney) {
        this.unionpayMoney = unionpayMoney;
    }

    public Double getGuoluMoney() {
        if (null == guoluMoney) {
            return 0D;
        }
        return guoluMoney;
    }

    public void setGuoluMoney(Double guoluMoney) {
        this.guoluMoney = guoluMoney;
    }

    public Double getYuanchengMoney() {
        if (null == yuanchengMoney) {
            return 0D;
        }
        return yuanchengMoney;
    }

    public void setYuanchengMoney(Double yuanchengMoney) {
        this.yuanchengMoney = yuanchengMoney;
    }

    public Boolean getTreatment() {
        return treatment == null ? false : treatment;
    }

    public void setTreatment(Boolean treatment) {
        this.treatment = treatment;
    }

    public PayTypeDetails getPrePayTypeDetail() {
        return prePayTypeDetail;
    }

    public void setPrePayTypeDetail(PayTypeDetails prePayTypeDetail) {
        this.prePayTypeDetail = prePayTypeDetail == null ? null : prePayTypeDetail;
    }

    public PayTypeDetails getAfterPayTypeDetail() {
        return afterPayTypeDetail;
    }

    public void setAfterPayTypeDetail(PayTypeDetails afterPayTypeDetail) {
        this.afterPayTypeDetail = afterPayTypeDetail == null ? null : afterPayTypeDetail;
    }

    public Double getOtherMoney() {
        if (null == this.otherMoney) {
            return 0D;
        }
        return otherMoney;
    }

    public void setOtherMoney(Double otherMoney) {

        this.otherMoney = otherMoney;
    }

    public String getShowPhone() {
        return showPhone;
    }

    public void setShowPhone(String showPhone) {
        this.showPhone = showPhone == null ? null : showPhone.trim();
    }

    public Double getWaitPrice() {
        return waitPrice;
    }

    public void setWaitPrice(Double waitPrice) {
        this.waitPrice = waitPrice;
    }

    public Boolean getFirstOrderFree() {
        return firstOrderFree;
    }

    public void setFirstOrderFree(Boolean firstOrderFree) {
        this.firstOrderFree = firstOrderFree;
    }

    public Date getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(Date finishTime) {
        this.finishTime = finishTime;
    }

    public boolean isBaoxiao() {
        return baoxiao;
    }

    public void setBaoxiao(boolean baoxiao) {
        this.baoxiao = baoxiao;
    }

    public Double getBaoxiaoMoney() {
        return baoxiaoMoney;
    }

    public void setBaoxiaoMoney(Double baoxiaoMoney) {
        this.baoxiaoMoney = baoxiaoMoney;
    }

    public String getEmployMemo() {
        return employMemo;
    }

    public void setEmployMemo(String employMemo) {
        this.employMemo = employMemo == null ? null : employMemo.trim();
    }

    public Date getTreatmentDate() {
        return treatmentDate;
    }

    public void setTreatmentDate(Date treatmentDate) {
        this.treatmentDate = treatmentDate;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public boolean getHasToPlace() {
        if (StringUtils.isBlank(endAddress) || null == endLng || null == endLat) {
            return false;
        }
        return true;
    }

    public String getOrderTypeStr() {
        if (orderType == TYPE_PINCHE) {
            return "城际拼车";
        } else if (orderType == TYPE_BAOCHE) {
            return "城际包车";
        } else if (orderType == TYPE_JIHUO) {
            return "城际寄货";
        }
        return "";
    }

    public boolean isYuyue() {
        if (null == serverDeadTime) {
            return false;
        }
        if (serverDeadTime.getTime() > System.currentTimeMillis()) {
            return true;
        } else {
            return false;
        }
    }

    public String getPreAndAfterPayType() {
        if (null != prePayTypeDetail || null != afterPayTypeDetail) {
            String str = "";
            if (null != prePayTypeDetail) {
                if (prePayTypeDetail.equals(PayTypeDetails.sign)) {
                    str = "签单";
                } else if (prePayTypeDetail.equals(PayTypeDetails.balance)) {
                    str = "余额";
                } else if (prePayTypeDetail.equals(PayTypeDetails.alipay)) {
                    str = "支付宝";
                } else if (prePayTypeDetail.equals(PayTypeDetails.weixin)) {
                    str = "微信";
                } else if (prePayTypeDetail.equals(PayTypeDetails.unionpay)) {
                    str = "银联";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_sign)) {
                    str = "优惠券+签单";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_balance)) {
                    str = "优惠券+余额";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_alipay)) {
                    str = "优惠券+支付宝";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_weixin)) {
                    str = "优惠券+微信";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon_unionpay)) {
                    str = "优惠券+银联";
                } else if (prePayTypeDetail.equals(PayTypeDetails.coupon)) {
                    str = "优惠券";
                }
            }
            if (null != afterPayTypeDetail) {
                if (afterPayTypeDetail.equals(PayTypeDetails.helppay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "代付";
                    } else {
                        if (!str.contains("代付")) {
                            str += "+代付";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.sign)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "签单";
                    } else {
                        if (!str.contains("签单")) {
                            str += "+签单";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.balance)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "余额";
                    } else {
                        if (!str.contains("余额")) {
                            str += "+余额";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.alipay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "支付宝";
                    } else {
                        if (!str.contains("支付宝")) {
                            str += "+支付宝";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.weixin)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "微信";
                    } else {
                        if (!str.contains("微信")) {
                            str += "+微信";
                        }
                    }
                } else if (afterPayTypeDetail.equals(PayTypeDetails.unionpay)) {
                    if (StringUtils.isEmpty(str)) {
                        str = "银联";
                    } else {
                        if (!str.contains("银联")) {
                            str += "+银联";
                        }
                    }
                }

            }
            if (null != randomRedPacket) {
                PayTypeDetails type = afterPayTypeDetail;
                if ("网站预约".equals(channelName) || "APP预约".equals(channelName) || "微信预约"
                    .equals(channelName)) {
                    if (PayTypeDetails.balance.equals(type) || PayTypeDetails.alipay.equals(type)
                        || PayTypeDetails.weixin.equals(type) || PayTypeDetails.unionpay
                        .equals(type)
                        || PayTypeDetails.coupon.equals(type) || PayTypeDetails.coupon_balance
                        .equals(type) || PayTypeDetails.coupon_alipay.equals(type)
                        || PayTypeDetails.coupon_weixin.equals(type)
                        || PayTypeDetails.coupon_unionpay.equals(type)) {
                        str += "+随机红包";
                    }
                }
            }
            if (!StringUtils.isEmpty(str)) {
                return str;
            } else {
                return null;
            }

        } else {
            return null;
        }
    }


    public String getPreAndAfterPayMoney() {

        String preAndAfterPayType = getPreAndAfterPayType();

        String str = "";
        if (null != preAndAfterPayType) {
            if (preAndAfterPayType.contains("优惠券")) {
                str += couponMoney + "+";
            }
            if (preAndAfterPayType.contains("签单") && preAndAfterPayType.contains("余额")) {
                if (preAndAfterPayType.indexOf("签单") == 0) {
                    str += signMoney + "+" + balanceMoney;
                } else if (preAndAfterPayType.indexOf("余额") == 0) {
                    str += balanceMoney + "+" + signMoney;
                }
            } else if (preAndAfterPayType.contains("签单")) {
                str += signMoney + "+";
            } else if (preAndAfterPayType.contains("余额")) {
                str += balanceMoney + "+";
            }
            if (preAndAfterPayType.contains("支付宝")) {
                str += alipayMoney + "+";
            }
            if (preAndAfterPayType.contains("微信")) {
                str += weixinMoney + "+";
            }
            if (preAndAfterPayType.contains("银联")) {
                str += unionpayMoney + "+";
            }
            if (preAndAfterPayType.contains("代付")) {
                str += cashMoney + "+";
            }
        }
        if (null != randomRedPacket) {
            PayTypeDetails type = afterPayTypeDetail;
            if ("网站预约".equals(channelName) || "APP预约".equals(channelName) || "微信预约"
                .equals(channelName)) {
                if (PayTypeDetails.balance.equals(type) || PayTypeDetails.alipay.equals(type)
                    || PayTypeDetails.weixin.equals(type) || PayTypeDetails.unionpay.equals(type)
                    || PayTypeDetails.coupon.equals(type) || PayTypeDetails.coupon_balance
                    .equals(type) || PayTypeDetails.coupon_alipay.equals(type)
                    || PayTypeDetails.coupon_weixin.equals(type)
                    || PayTypeDetails.coupon_unionpay.equals(type)) {
                    if (randomRedPacket >= realPay) {
                        str += realPay + "+";
                    } else {
                        str += randomRedPacket + "+";
                    }
                }
            }
        }
        if (!StringUtils.isEmpty(str)) {
            return str.substring(0, str.length() - 1);
        } else {
            return null;
        }

    }

    public enum PayTypeDetails {
        /**
         * 代付
         */
        helppay,
        /**
         * 签单
         */
        sign,
        /**
         * 余额
         */
        balance,
        /**
         * 支付宝
         */
        alipay,
        /**
         * 微信
         */
        weixin,
        /**
         * 银联支付
         */
        unionpay,

        /**
         * 优惠劵
         */
        coupon,

        /**
         * 优惠劵+签单
         */
        coupon_sign,
        /**
         * 优惠劵+余额
         */
        coupon_balance,
        /**
         * 优惠劵+支付宝
         */
        coupon_alipay,
        /**
         * 优惠劵+微信
         */
        coupon_weixin,
        /**
         * 优惠券+银联
         */
        coupon_unionpay,

    }

}
